package com.dmx.fw.bean.mapping.pojo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * CacheCode generated by MyEclipse - Hibernate Tools
 */
@Entity
@Table(name="SYSTEM_CACHE_CODE")
public class CacheCode implements java.io.Serializable {
	public static final String CONFIG_TYPE_parm_data = "PARM_DATA";
	public static final String CONFIG_TYPE_cach_code = "CACH_CODE";

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO,generator="cach_code_seq_gen")
	@SequenceGenerator(name = "cach_code_seq_gen", sequenceName = "SEQ_CACH_CODE")
	@Column(name = "ID", precision = 12, scale = 0)
	private Long cachCodeId;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "LAST_UPDATED_TIME")
	private Date lastUpdatedTime;
	
	@Column(name="CODE",length=60)
	private String code;
	
	@Column(name="NAME",length=60)
	private String name;
	
	@Column(name="LIST_SQL",length=2000)
	private String listSql;
	
	@Column(name="IS_CACHE")
	private String cached;
	
	@Column(name="PARM_CODE",length=60)
	private String parmCode;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CREATED_BY",insertable=false,updatable=false)
	private Operator createdOperator;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "CREATED_TIME")
	private Date createdTime;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="LAST_UPDATED_BY",insertable=false,updatable=false)
	private Operator lastUpdatedOperator;

	// 以下两个参数不属于hibernate映射的范围内，是作为bean的属性使用的
	// 字典配置来源，CACHE_CODE表示通过CACH_CODE表配置的，PARM_DATA表示自动从PARM_DATA获取
	@Transient
	private String configType = "CACH_CODE";
	// 是否基于管理区域管理，只有configType=='PARM_DATA's时，这个参数才有意义
	@Transient
	private String partitionByMgrDmn = "0";

	// Constructors

	/** default constructor */
	public CacheCode() {
	}

	/** full constructor */
	public CacheCode(String code, String name, String listSql, String cached,
			String parmCode, Operator createdOperator, Date createdTime,
			Operator lastUpdatedOperator) {
		this.code = code;
		this.name = name;
		this.listSql = listSql;
		this.cached = cached;
		this.parmCode = parmCode;
		this.createdOperator = createdOperator;
		this.createdTime = createdTime;
		this.lastUpdatedOperator = lastUpdatedOperator;
	}

	// Property accessors

	public Long getCachCodeId() {
		return this.cachCodeId;
	}

	public void setCachCodeId(Long cachCodeId) {
		this.cachCodeId = cachCodeId;
	}

	public Date getLastUpdatedTime() {
		return this.lastUpdatedTime;
	}

	public void setLastUpdatedTime(Date lastUpdatedTime) {
		this.lastUpdatedTime = lastUpdatedTime;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getListSql() {
		return this.listSql;
	}

	public void setListSql(String listSql) {
		this.listSql = listSql;
	}

	public String getCached() {
		return this.cached;
	}

	public void setCached(String cached) {
		this.cached = cached;
	}

	public String getParmCode() {
		return this.parmCode;
	}

	public void setParmCode(String parmCode) {
		this.parmCode = parmCode;
	}

	public Operator getCreatedOperator() {
		return this.createdOperator;
	}

	public void setCreatedOperator(Operator createdOperator) {
		this.createdOperator = createdOperator;
	}

	public Date getCreatedTime() {
		return this.createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Operator getLastUpdatedOperator() {
		return this.lastUpdatedOperator;
	}

	public void setLastUpdatedOperator(Operator lastUpdatedOperator) {
		this.lastUpdatedOperator = lastUpdatedOperator;
	}

	public String getConfigType() {
		return configType;
	}

	public void setConfigType(String configType) {
		this.configType = configType;
	}

	public String getPartitionByMgrDmn() {
		return partitionByMgrDmn;
	}

	public void setPartitionByMgrDmn(String partitionByMgrDmn) {
		this.partitionByMgrDmn = partitionByMgrDmn;
	}

}